function assignedTTChange() {
    var combo = document.getElementById('assignedTTCombo');
    var type = combo.options[combo.selectedIndex].value;
    location.href = "showTickets.php?status=" + type + "&MAView=true";
}

function myTTChange() {
    var combo = document.getElementById('myTTCombo');
    var type = combo.options[combo.selectedIndex].value;
    location.href = "showTickets.php?status=" + type;
}

function onload() {
    unresolvedChange(document.getElementById("unresolved").options[document.getElementById("unresolved").selectedIndex].value);
}
function stateChange(selectedState) {
    var strURL="Javascript/phpHandlers/findStores.php?selectedState="+selectedState;
    var req = getXMLHTTP();
    if (req) {
        req.onreadystatechange = function() {
            if (req.readyState == 4) {
                // only if "OK"
                if (req.status == 200) {
                    document.getElementById('storeDiv').innerHTML=req.responseText;
                } else {
                    alert("There was a problem while using XMLHTTP:\n" + req.statusText);
                }
            }
        }
        req.open("GET", strURL, true);
        req.send(null);
        setTimeout("storeAbbrevChange(document.getElementById(\"storeAbbrev\").value)", 100);

    }
}

function storeAbbrevChange(storeAbbrev) {
    var strURL = "Javascript/phpHandlers/updateStoreObject.php?storeAbbrev="+storeAbbrev;
    var req = getXMLHTTP();
    req.open("GET", strURL, true);
    req.send(null);
    setTimeout("updateMainContent()", 100);
}

function updateMainContent() {
    var strURL = "JavaScript/phpHandlers/main_submitButton.php";
    var req = getXMLHTTP();
    if (req) {
        req.onreadystatechange = function() {
            if (req.readyState == 4) {
                // only if "OK"
                if (req.status == 200) {
                    document.getElementById('maincontent').innerHTML=req.responseText;
                } else {
                    alert("There was a problem while using XMLHTTP:\n" + req.statusText);
                }
            }
        }
        req.open("GET", strURL, true);
        req.send(null);
    }
    unresolvedChange(document.getElementById("unresolved").options[document.getElementById("unresolved").selectedIndex].value);
}
function unresolvedChange(table) {
    var strURL = "JavaScript/phpHandlers/getTickets.php?table=" + table;
    var req = getXMLHTTP();
    if (req) {
        req.onreadystatechange = function() {
            if (req.readyState == 4) {
                // only if "OK"
                if (req.status == 200) {
                    document.getElementById('unresolvedTickets').innerHTML=req.responseText;
                } else {
                    alert("There was a problem while using XMLHTTP:\n" + req.statusText);
                }
            }
        }
        req.open("GET", strURL, true);
        req.send(null);
    }
}
function getXMLHTTP() {
    var xmlhttp=false;
    try{
        xmlhttp=new XMLHttpRequest();
    }
    catch(e)	{
        try{
            xmlhttp= new ActiveXObject("Microsoft.XMLHTTP");
        }
        catch(e){
            try{
                xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
            }
            catch(e1){
                xmlhttp=false;
            }
        }
    }
    return xmlhttp;
}